<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 */
class Application_Model_Formation extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Idformation;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_NameForm;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_UrlPf;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_UrlWs;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_User;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_Password;



    /**
     * Dependent relation fk_rapport_formation1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Rapport
     */
    protected $_Rapport;

    /**
     * Dependent relation fk_semestre_formation
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Semestre
     */
    protected $_Semestre;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idformation'=>'Idformation',
            'name_form'=>'NameForm',
            'url_pf'=>'UrlPf',
            'url_ws'=>'UrlWs',
            'user'=>'User',
            'password'=>'Password',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkRapportFormation1' => array(
                    'property' => 'Rapport',
                    'table_name' => 'Rapport',
                ),
            'FkSemestreFormation' => array(
                    'property' => 'Semestre',
                    'table_name' => 'Semestre',
                ),
        ));
    }

    /**
     * Sets column idformation
     *
     * @param int $data
     * @return Application_Model_Formation
     */
    public function setIdformation($data)
    {
        $this->_Idformation = $data;
        return $this;
    }

    /**
     * Gets column idformation
     *
     * @return int
     */
    public function getIdformation()
    {
        return $this->_Idformation;
    }

    /**
     * Sets column name_form
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setNameForm($data)
    {
        $this->_NameForm = $data;
        return $this;
    }

    /**
     * Gets column name_form
     *
     * @return string
     */
    public function getNameForm()
    {
        return $this->_NameForm;
    }

    /**
     * Sets column url_pf
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setUrlPf($data)
    {
        $this->_UrlPf = $data;
        return $this;
    }

    /**
     * Gets column url_pf
     *
     * @return string
     */
    public function getUrlPf()
    {
        return $this->_UrlPf;
    }

    /**
     * Sets column url_ws
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setUrlWs($data)
    {
        $this->_UrlWs = $data;
        return $this;
    }

    /**
     * Gets column url_ws
     *
     * @return string
     */
    public function getUrlWs()
    {
        return $this->_UrlWs;
    }

    /**
     * Sets column user
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setUser($data)
    {
        $this->_User = $data;
        return $this;
    }

    /**
     * Gets column user
     *
     * @return string
     */
    public function getUser()
    {
        return $this->_User;
    }

    /**
     * Sets column password
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setPassword($data)
    {
        $this->_Password = $data;
        return $this;
    }

    /**
     * Gets column password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->_Password;
    }

    /**
     * Sets dependent relations fk_rapport_formation1
     *
     * @param array $data An array of Application_Model_Rapport
     * @return Application_Model_Formation
     */
    public function setRapport(array $data)
    {
        $this->_Rapport = array();

        foreach ($data as $object) {
            $this->addRapport($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_rapport_formation1
     *
     * @param Application_Model_Rapport $data
     * @return Application_Model_Formation
     */
    public function addRapport(Application_Model_Rapport $data)
    {
        $this->_Rapport[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_rapport_formation1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Rapport
     */
    public function getRapport($load = true)
    {
        if ($this->_Rapport === null && $load) {
            $this->getMapper()->loadRelated('FkRapportFormation1', $this);
        }

        return $this->_Rapport;
    }

    /**
     * Sets dependent relations fk_semestre_formation
     *
     * @param array $data An array of Application_Model_Semestre
     * @return Application_Model_Formation
     */
    public function setSemestre(array $data)
    {
        $this->_Semestre = array();

        foreach ($data as $object) {
            $this->addSemestre($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_semestre_formation
     *
     * @param Application_Model_Semestre $data
     * @return Application_Model_Formation
     */
    public function addSemestre(Application_Model_Semestre $data)
    {
        $this->_Semestre[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_semestre_formation
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Semestre
     */
    public function getSemestre($load = true)
    {
        if ($this->_Semestre === null && $load) {
            $this->getMapper()->loadRelated('FkSemestreFormation', $this);
        }

        return $this->_Semestre;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Formation
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Formation());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Formation::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdformation() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idformation = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdformation()));
    }
}
